import request from "@/utils/request.js";

/**
 * 获取课程大纲
 *
 */
export function getCourseOutline(id) {
    return request.get(`product/get/courseOutline?id=${id}`);
}

/**
 * 获取课程资料
 *
 */
export function getCourseMaterials(data) {
    return request.get(`product/get/courseMaterials?id=${data.id}&limit=${data.limit}&page=${data.page}`);
}

/**
 * 消息
 *
 */
export function getMessage() {
    return request.get(`message/list`);
}

/**
 * 消息列表
 *
 */
export function getMaterialsPageList(data) {
    return request.get(`message/page/list?id=${data.id}&limit=${data.limit}&page=${data.page}&messageType=${data.messageType}`);
}

/**
 * 消息已读
 *
 */
export function postMessagesRead(data) {
    return request.post("message/read", data);
}

/**
 * 已学课程
 *
 */
export function getCoursesLearnedList(data) {
    return request.get(`progress/list?limit=${data.limit}&page=${data.page}`);
}

/**
 * 关注列表
 *
 */
export function getFollowList(data) {
    return request.get(`follow/product/list?limit=${data.limit}&page=${data.page}`);
}

/**
 * 关注
 *
 */
export function postFollow(id,category) {
    return request.post("follow/add/product", {productId: id,category:category});
}

/**
 * 取消关注
 *
 */
export function postUnfollow(id) {
    return request.post("follow/cancel/product", {ids: id});
}

/**
 * 举报
 *
 */
export function postReport(data) {
    return request.post("record/add/product", data);
}

/**
 * 反馈
 *
 */
export function postFeedback(data) {
    return request.post("record/add/feedback", data);
}

/**
 * 反馈列表
 *
 */
export function getFeedbackList(data) {
    return request.get(`record/query/page?limit=${data.limit}&page=${data.page}&complete=${data.complete}`);
}

/**
 * 转发
 *
 */
export function postForward(id,targetType) {
    return request.post("share/record/add", {targetId: id,targetType:targetType});
}

/**
 * 转发列表
 *
 */
export function getForwardList(data) {
    return request.get(`share/record/list?limit=${data.limit}&page=${data.page}`);
}

/**
 * 最近在学列表
 *
 */
// export function getRecentlyStudyList(data) {
//     return request.get(`get/recently/study/list?limit=${data.limit}&page=${data.page}`);
// }

/**
 * 获取课程详情
 *
 */
export function getDetail(data) {
    return request.get(`courseOutline/get/detail?id=${data.id}&productId=${data.productId}`);
}

/**
 * 点赞
 *
 */
export function postLike(id,category) {
    return request.post("like/add/product", {productId: id,category:category});
}

/**
 * 取消点赞
 *
 */
export function postCancelLikes(id) {
    return request.post("like/cancel/product", {ids: id});
}

/**
 * 踩
 *
 */
export function postTrample(id,category) {
    return request.post("trample/add/product", {productId: id,category:category});
}

/**
 * 取消踩
 *
 */
export function postNotTrample(id) {
    return request.post("trample/cancel/product", {ids: id});
}

/**
 * 看完
 *
 */
export function postCompleted(courseId,outlineId) {
    return request.get("progress/completed", {courseId: courseId,outlineId: outlineId});
}

/**
 * 进度
 *
 */
export function postRecord(data) {
    return request.post("progress/update", data);
}

/**
 * 老师列表
 *
 */
export function getTeacherList(data) {
    return request.get("teacher/list", data);
}

/**
 * 老师分类
 *
 */
export function getTeacherCategory() {
    return request.get("teacher/category");
}

/**
 * 老师轮播图
 *
 */
export function getTeacherBanner() {
    return request.get("teacher/banner");
}

/**
 * 课程列表
 *
 */
export function getTeacherCourseList(data) {
    return request.get("teacher/course/list",data);
}

/**
 * 相关课程列表
 *
 */
export function getTeacherCourseRelated(data) {
    return request.get("teacher/course/related",data);
}

/**
 * 我的课程
 *
 */
export function getAccessList(data) {
    return request.get("access/list",data);
}

/**
 * 生成核销二维码
 *
 */
export function getAccessQrcode(data) {
    return request.get("access/qrcode",data);
}

/**
 * 地址数据
 *
 */
export function getCommonListAddr(data) {
    return request.get("common/listAddr",data);
}

/**
 * 当前位置
 *
 */
export function getCommonReverseGeocoder(data) {
    return request.get("common/reverseGeocoder",data);
}

/**
 * 关于我们
 *
 */
export function getAgreementAboutusinfo(data) {
    return request.get("agreement/aboutusinfo",data);
}

/**
 * 关于我们
 *
 */
export function getAgreementContactUs(data) {
    return request.get("agreement/contact/us",data);
}